package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.ContractMapperCustom;
import com.cq.ssm.mapper.ContractMapper;
import com.cq.ssm.po.Contract;
import com.cq.ssm.po.ContractCustom;
import com.cq.ssm.service.ContractService;

@Component("contractService")
public class ContractServiceImpl implements ContractService {

	@Autowired
	private ContractMapper cm;
	@Autowired
	private ContractMapperCustom cmc;
	//根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception{
		int i = cm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}
	
	//根据stuffId查询记录
	public List<ContractCustom> findByStuffID(Integer id) throws Exception{
		return cmc.findByStuffID(id);
	}
	
	//插入一条记录
	public boolean insertContract(Contract contract) throws Exception{
		int i = cm.insertSelective(contract);
		return i==1?true:false;
	}

}
